home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue58 / Clinic / TrimWorkingSet.pas < prev   
Encoding:
Pascal/Delphi Source File  |  2000-04-19  |  581 b   |  33 lines

  1. unit TrimWorkingSet;
  2.  
  3. interface
  4.  
  5. implementation
  6.  
  7. uses
  8.   SysUtils, Windows, ExtCtrls;
  9.  
  10. type
  11.   TTrimmer = class(TTimer)
  12.   public
  13.     procedure TimerTick(Sender: TObject);
  14.   end;
  15.  
  16. procedure TTrimmer.TimerTick(Sender: TObject);
  17. begin
  18.   if Win32Platform = VER_PLATFORM_WIN32_NT then
  19.     SetProcessWorkingSetSize(GetCurrentProcess, $FFFFFFFF, $FFFFFFFF)
  20. end;
  21.  
  22. var
  23.   Timer: TTrimmer;
  24.  
  25. initialization
  26.   Timer := TTrimmer.Create(nil);
  27.   Timer.Interval := 30000;
  28.   Timer.OnTimer := Timer.TimerTick;
  29. finalization
  30.   if Assigned(Timer) then
  31.     Timer.Free;
  32. end.
  33.